package com.Android.RSSReader;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends Activity
{
	@Override
	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		setContentView(R.layout.main);

		Button OKbutton = (Button) findViewById(R.id.ok);

		OKbutton.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
		    	 Intent intent = new Intent(v.getContext(),MobileRSSReaderActivity.class);		    
		         Bundle bundle = new Bundle();
		         
		         EditText txt1 = (EditText) findViewById(R.id.rssfeed);
		         String s;
		         //Testing
		         if(txt1.getText().toString().equals("ibm")){
		        	 s = "http://www.ibm.com/developerworks/views/rss/customrssatom.jsp?zone_by=XML&zone_by=Java&zone_by=Rational&zone_by=Linux&zone_by=Open+source&zone_by=WebSphere&type_by=Tutorials&search_by=&day=1&month=06&year=2007&max_entries=20&feed_by=rss&isGUI=true&Submit.x=48&Submit.y=14";
		         }
		         else if(txt1.getText().toString().equals("espn")){
		        	 s = "http://sports.espn.go.com/espn/rss/news";
		         }
		         else{
		        	 s = "http://p.moreover.com/cgi-local/page?index_ibm+rss";
		         }

		         //bundle.putString("rss", txt1.getText().toString());
		         bundle.putString("rss", s);
		         
		         //Add the set of extended data to the intent and start it
		         intent.putExtras(bundle);
		    	 startActivity(intent);
			}
		});		
	}
}
